{include file="kuerp/common/menu" /}
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="row">
        <div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-4 top7">{:__('Purchase_code')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-purchase_code" class="form-control" data-rule="required" value="{$row.purchase_code|default=''}" name="row[purchase_code]" type="text" placeholder="{:__('Purchase_code')}">
                    <input type="hidden" name="row[cost_id]" value="{$row.cost_id|default=''}">
                </div>
            </div>
        </div>
        <div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-4 top7">{:__('Purchase_time')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-purchase_time" class="form-control datetime" name="row[purchase_time]" type="text" value="{$row.purchase_time|date='Y-m-d',###}" placeholder="{:__('Purchase_time')}">
                </div>
            </div>
        </div>
    </div>

    <div class="table_box">
        <div class="list">
            <table id="account_table">
                <tr>
                    <th class="{$exclass|default=''}"></th><th>转出账户</th><th>转入账户</th><th>金额</th><th>结算方式</th><th>结算号</th><th>备注</th>
                </tr>
                <tr style="display: none;">
                    <td class="{$exclass|default=''}"><div class="btn"><span class="add"><i class="fa fa-plus"></i></span><span class="del"><i class="fa fa-trash"></i></span></div></td>
                    <td>
                        <select name="row[accounts_out_id][]" class="form-control accounts_out_id">
                            <option value=""></option>
                            {foreach name="accountsList" item="vo"}
                            <option value="{$vo.id}">{$vo.account_name}</option>
                            {/foreach}
                        </select>
                    </td>
                    <td>
                        <select name="row[accounts_enter_id][]" class="form-control accounts_enter_id">
                            <option value=""></option>
                            {foreach name="accountsList" item="vo"}
                            <option value="{$vo.id}">{$vo.account_name}</option>
                            {/foreach}
                        </select>
                    </td>
                    <td><input type="number" name="row[money][]" class="account_money number_decimal"></td>
                    <td>
                        <select name="row[settlementtype][]" class="form-control settlementtype">
                            <option value=""></option>
                            {foreach name="settlementtype" item="vo"}
                            <option value="{$vo.id}">{$vo.name}</option>
                            {/foreach}
                        </select>
                    </td>
                    <td><input type="text" name="row[settlement_number][]" class="settlement_number"></td>
                    <td><input type="text" name="row[remark][]" class="remark"></td>
                </tr>
                {foreach name="info" item="vos"}
                <tr>
                    <td class="{$exclass|default=''}"><div class="btn"><span class="add"><i class="fa fa-plus"></i></span><span class="del"><i class="fa fa-trash"></i></span></div></td>
                    <td>
                        <select name="row[accounts_out_id][]" class="form-control accounts_out_id">
                            <option value=""></option>
                            {foreach name="accountsList" item="vo"}
                            <option value="{$vo.id}" {if condition="$vo.id==$vos.accounts_out_id"}selected{/if}>{$vo.account_name}</option>
                            {/foreach}
                        </select>
                    </td>
                    <td>
                        <select name="row[accounts_enter_id][]" class="form-control accounts_enter_id">
                            <option value=""></option>
                            {foreach name="accountsList" item="vo"}
                            <option value="{$vo.id}" {if condition="$vo.id==$vos.accounts_enter_id"}selected{/if}>{$vo.account_name}</option>
                            {/foreach}
                        </select>
                    </td>
                    <td><input type="number" name="row[money][]" value="{$vos.money}" class="account_money number_decimal"></td>
                    <td>
                        <select name="row[settlementtype][]" class="form-control settlementtype">
                            <option value=""></option>
                            {foreach name="settlementtype" item="vo"}
                            <option value="{$vo.id}" {if condition="$vo.id==$vos.settlementtype_id"}selected{/if}>{$vo.name}</option>
                            {/foreach}
                        </select>
                    </td>
                    <td><input type="text" name="row[settlement_number][]" value="{$vos.settlement_number}" class="settlement_number"></td>
                    <td><input type="text" name="row[remark][]" value="{$vos.remark}" class="remark"></td>
                </tr>
                {/foreach}
                {php}for($a=1;$a<=(4-sizeof($info));$a++){{/php}
                <tr>
                    <td class="{$exclass|default=''}"><div class="btn"><span class="add"><i class="fa fa-plus"></i></span><span class="del"><i class="fa fa-trash"></i></span></div></td>
                    <td>
                        <select name="row[accounts_out_id][]" class="form-control accounts_out_id">
                            <option value=""></option>
                            {foreach name="accountsList" item="vo"}
                            <option value="{$vo.id}">{$vo.account_name}</option>
                            {/foreach}
                        </select>
                    </td>
                    <td>
                        <select name="row[accounts_enter_id][]" class="form-control accounts_enter_id">
                            <option value=""></option>
                            {foreach name="accountsList" item="vo"}
                            <option value="{$vo.id}">{$vo.account_name}</option>
                            {/foreach}
                        </select>
                    </td>
                    <td><input type="number" name="row[money][]" class="account_money number_decimal"></td>
                    <td>
                        <select name="row[settlementtype][]" class="form-control settlementtype">
                            <option value=""></option>
                            {foreach name="settlementtype" item="vo"}
                            <option value="{$vo.id}">{$vo.name}</option>
                            {/foreach}
                        </select>
                    </td>
                    <td><input type="text" name="row[settlement_number][]" class="settlement_number"></td>
                    <td><input type="text" name="row[remark][]" class="remark"></td>
                </tr>
                {php}}{/php}
                <tr>
                    <td class="{$exclass|default=''}"></td>
                    <td><div>合计</div></td>
                    <td></td>
                    <td><div><input type="text" readonly class="money_hj" value="{$money_hj}"></div></td>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>
            </table>
        </div>
    </div>

    <div class="row" style="margin-bottom: 10px;">
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
            <textarea id="c-note" class="form-control" rows="4" name="row[note]" cols="30" placeholder="备注信息">{$row.remark|default=''}</textarea>
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
